package com.zhenghaijin.recommendationservice.task;

import com.zhenghaijin.recommendationservice.service.RecommendationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class RecommendationScheduler {

    @Autowired
    private RecommendationService recommendationService;

    // 每天凌晨3点执行一次
    @Scheduled(cron = "0 0 3 * * ?")
    public void scheduleRefresh() {
        recommendationService.refreshRecommendations();
    }
}